package com.aaa.day113.demo1;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月03日9:13
 */
public class Test {
    public static void main(String[] args) {


        MyRunnable my=new MyRunnable();
        Thread t1 = new Thread(my);
        t1.start();
        //使用匿名内部类
        Runnable runnable=new Runnable() {
            @Override
            public void run() {
                System.out.println("============匿名内部类");

            }
        };
        Thread t2 = new Thread(runnable);
        t2.start();

        //lambda表达式
        Runnable r=()->{
            System.out.println("这是lambda表达式");
        };
        Thread t3 = new Thread(r);
        t3.start();

    }
}
class MyRunnable implements Runnable{

    @Override
    public void run() {
        System.out.println("============自定义接口实现类");
    }
}

